package com.distribute.framework.model;

import com.distribute.framework.core.web.helper.Utils;
import java.lang.reflect.Field;
import java.util.Date; 
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;

import javax.annotation.Resource;

import com.distribute.framework.core.web.util.Page;
import com.distribute.framework.core.lang.*; 
import com.distribute.framework.core.web.helper.WebHelper.LzMap;
import com.distribute.framework.core.util.Function;
import com.distribute.framework.core.util.IbatisMap;
import com.distribute.framework.config.*;
import com.distribute.framework.plugin.*;

@namespace("partner/config")
public @caption("合伙人卡配置") @database(DatabaseNames.distribute_sys) @source("distribute_sys") @table("tb_partner_config") class TbPartnerConfig implements java.io.Serializable
{
	private static final long serialVersionUID = 1l;
		
	
		
	private @caption("编号") @column("tbpc_id")    @primary  @notnull  @note("  ") Long tbpcId;// 主键 非空     
			
 			
 			
 		
	
		
	private @caption("品牌") @column("tbpc_brand")      @relate("$tbpcBrand") @RelateClass(Merchant.class)  @note("  ") Long tbpcBrand;//     
			
 	private transient Merchant $tbpcBrand;//关联对象[品牌信息]
 			
 			
 			
 		
	
		
	private @caption("合伙人卡名称") @column("tbpc_card_name")      @note("  ") String tbpcCardName;//     
			
 			
 			
 		
	
		
	private @caption("价格") @column("tbpc_price")      @note("  ") Double tbpcPrice;//     
			
 			
 			
 		
	
		
	private @caption("产品配置") @column("tbpc_products") @like  @hidden    @note(" query:goods text:number money:price  ") String tbpcProducts;// query:goods text:number money:price     
			
 			
 			
 		
	
		
	private @caption("普通间接奖励") @column("tbpc_pt_jj")      @note("  ") Double tbpcPtJj;//     
			
 			
 			
 		
	
		
	private @caption("普通直接奖励") @column("tbpc_pt_zhj")      @note("  ") Double tbpcPtZhj;//     
			
 			
 			
 		
	
		
	private @caption("代理间接奖励") @column("tbpc_dl_jj")      @note("  ") Double tbpcDlJj;//     
			
 			
 			
 		
	
		
	private @caption("代理直接奖励") @column("tbpc_dl_zhj")      @note("  ") Double tbpcDlZhj;//     
			
 			
 			
 		
	
		
	private @caption("合伙人有效期") @column("tbpc_validity")      @note("  已月为单位12 代表12个月后失效") Integer tbpcValidity;//  已月为单位12 代表12个月后失效   
			
 			
 			
 		
	
		
	private @caption("续期订单总额") @column("tbpc_money")      @note("  总金额大于设置的金额，要到期的时候自动续有效期。") Double tbpcMoney;//  总金额大于设置的金额，要到期的时候自动续有效期。   
			
 			
 			
 		
	
		
	private @caption("政策概述") @column("tbpc_zc_gsh") @like  @hidden    @note("  ") String tbpcZcGsh;//     
			
 			
 			
 		
	
		
	private @caption("协议") @column("tbpc_xy") @like  @hidden    @note("  ") String tbpcXy;//     
			
 			
 			
 		
	
		
	private @caption("奖励政策") @column("tbpc_fx_zc") @like  @hidden    @note("  ") String tbpcFxZc;//     
			
 			
 			
 		
	
		
	private @caption("权益介绍") @column("tbpc_qy_jsh") @like  @hidden    @note("  ") String tbpcQyJsh;//     
			
 			
 			
 		
	
		
	private @caption("加入条件") @column("tbpc_jr_tj") @like  @hidden    @note("  ") String tbpcJrTj;//     
			
 			
 			
 		
	
		
	private @caption("合伙人权益介绍") @column("tbpc_hhr_qy") @like  @hidden    @note("  ") String tbpcHhrQy;//     
			
 			
 			
 		
	
		
	private @caption("二维码") @column("tbpc_qr_code")      @note("  ") String tbpcQrCode;//     
			
 			
 			
 		
	
	 
	//默认构造函数
	public TbPartnerConfig(){ 
	
	}
	
	//主键构造函数
	public TbPartnerConfig(Long id){
		this.tbpcId = id;
	}
	
	/**所有字段构造函数 
	 TbPartnerConfig(
	 	Utils.getLong("brand")//品牌
	 	,Utils.getString("cardName")//合伙人卡名称
	 	,Utils.getDouble("price")//价格
	 	,Utils.getString("products")//产品配置
	 	,Utils.getDouble("ptJj")//普通间接奖励
	 	,Utils.getDouble("ptZhj")//普通直接奖励
	 	,Utils.getDouble("dlJj")//代理间接奖励
	 	,Utils.getDouble("dlZhj")//代理直接奖励
	 	,Utils.getInteger("validity")//合伙人有效期
	 	,Utils.getDouble("money")//续期订单总额
	 	,Utils.getString("zcGsh")//政策概述
	 	,Utils.getString("xy")//协议
	 	,Utils.getString("fxZc")//奖励政策
	 	,Utils.getString("qyJsh")//权益介绍
	 	,Utils.getString("jrTj")//加入条件
	 	,Utils.getString("hhrQy")//合伙人权益介绍
	 	,Utils.getString("qrCode")//二维码
	 )
	**/
	public TbPartnerConfig(Long tbpcBrand,String tbpcCardName,Double tbpcPrice,String tbpcProducts,Double tbpcPtJj,Double tbpcPtZhj,Double tbpcDlJj,Double tbpcDlZhj,Integer tbpcValidity,Double tbpcMoney,String tbpcZcGsh,String tbpcXy,String tbpcFxZc,String tbpcQyJsh,String tbpcJrTj,String tbpcHhrQy,String tbpcQrCode){
		
			
			
		this.tbpcBrand=tbpcBrand;
		
			
		this.tbpcCardName=tbpcCardName;
		
			
		this.tbpcPrice=tbpcPrice;
		
			
		this.tbpcProducts=tbpcProducts;
		
			
		this.tbpcPtJj=tbpcPtJj;
		
			
		this.tbpcPtZhj=tbpcPtZhj;
		
			
		this.tbpcDlJj=tbpcDlJj;
		
			
		this.tbpcDlZhj=tbpcDlZhj;
		
			
		this.tbpcValidity=tbpcValidity;
		
			
		this.tbpcMoney=tbpcMoney;
		
			
		this.tbpcZcGsh=tbpcZcGsh;
		
			
		this.tbpcXy=tbpcXy;
		
			
		this.tbpcFxZc=tbpcFxZc;
		
			
		this.tbpcQyJsh=tbpcQyJsh;
		
			
		this.tbpcJrTj=tbpcJrTj;
		
			
		this.tbpcHhrQy=tbpcHhrQy;
		
			
		this.tbpcQrCode=tbpcQrCode;
		
	}
	
	//设置非空字段
	public TbPartnerConfig setNotNull(){
		
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		return this;
	}
	
	
		
	/** 编号 [非空]       **/
	public TbPartnerConfig tbpcId(Long tbpcId){
		this.tbpcId = tbpcId;
		this.setSeted(F.tbpcId);
		return this;
	}
	
		
	/** 品牌  [Merchant]      **/
	public TbPartnerConfig tbpcBrand(Long tbpcBrand){
		this.tbpcBrand = tbpcBrand;
		this.setSeted(F.tbpcBrand);
		return this;
	}
	
		
	/** 合伙人卡名称        **/
	public TbPartnerConfig tbpcCardName(String tbpcCardName){
		this.tbpcCardName = tbpcCardName;
		this.setSeted(F.tbpcCardName);
		return this;
	}
	
		
	/** 价格        **/
	public TbPartnerConfig tbpcPrice(Double tbpcPrice){
		this.tbpcPrice = tbpcPrice;
		this.setSeted(F.tbpcPrice);
		return this;
	}
	
		
	/** 产品配置    query:goods text:number money:price     **/
	public TbPartnerConfig tbpcProducts(String tbpcProducts){
		this.tbpcProducts = tbpcProducts;
		this.setSeted(F.tbpcProducts);
		return this;
	}
	
		
	/** 普通间接奖励        **/
	public TbPartnerConfig tbpcPtJj(Double tbpcPtJj){
		this.tbpcPtJj = tbpcPtJj;
		this.setSeted(F.tbpcPtJj);
		return this;
	}
	
		
	/** 普通直接奖励        **/
	public TbPartnerConfig tbpcPtZhj(Double tbpcPtZhj){
		this.tbpcPtZhj = tbpcPtZhj;
		this.setSeted(F.tbpcPtZhj);
		return this;
	}
	
		
	/** 代理间接奖励        **/
	public TbPartnerConfig tbpcDlJj(Double tbpcDlJj){
		this.tbpcDlJj = tbpcDlJj;
		this.setSeted(F.tbpcDlJj);
		return this;
	}
	
		
	/** 代理直接奖励        **/
	public TbPartnerConfig tbpcDlZhj(Double tbpcDlZhj){
		this.tbpcDlZhj = tbpcDlZhj;
		this.setSeted(F.tbpcDlZhj);
		return this;
	}
	
		
	/** 合伙人有效期     已月为单位12 代表12个月后失效   **/
	public TbPartnerConfig tbpcValidity(Integer tbpcValidity){
		this.tbpcValidity = tbpcValidity;
		this.setSeted(F.tbpcValidity);
		return this;
	}
	
		
	/** 续期订单总额     总金额大于设置的金额，要到期的时候自动续有效期。   **/
	public TbPartnerConfig tbpcMoney(Double tbpcMoney){
		this.tbpcMoney = tbpcMoney;
		this.setSeted(F.tbpcMoney);
		return this;
	}
	
		
	/** 政策概述        **/
	public TbPartnerConfig tbpcZcGsh(String tbpcZcGsh){
		this.tbpcZcGsh = tbpcZcGsh;
		this.setSeted(F.tbpcZcGsh);
		return this;
	}
	
		
	/** 协议        **/
	public TbPartnerConfig tbpcXy(String tbpcXy){
		this.tbpcXy = tbpcXy;
		this.setSeted(F.tbpcXy);
		return this;
	}
	
		
	/** 奖励政策        **/
	public TbPartnerConfig tbpcFxZc(String tbpcFxZc){
		this.tbpcFxZc = tbpcFxZc;
		this.setSeted(F.tbpcFxZc);
		return this;
	}
	
		
	/** 权益介绍        **/
	public TbPartnerConfig tbpcQyJsh(String tbpcQyJsh){
		this.tbpcQyJsh = tbpcQyJsh;
		this.setSeted(F.tbpcQyJsh);
		return this;
	}
	
		
	/** 加入条件        **/
	public TbPartnerConfig tbpcJrTj(String tbpcJrTj){
		this.tbpcJrTj = tbpcJrTj;
		this.setSeted(F.tbpcJrTj);
		return this;
	}
	
		
	/** 合伙人权益介绍        **/
	public TbPartnerConfig tbpcHhrQy(String tbpcHhrQy){
		this.tbpcHhrQy = tbpcHhrQy;
		this.setSeted(F.tbpcHhrQy);
		return this;
	}
	
		
	/** 二维码        **/
	public TbPartnerConfig tbpcQrCode(String tbpcQrCode){
		this.tbpcQrCode = tbpcQrCode;
		this.setSeted(F.tbpcQrCode);
		return this;
	}
	
	
	
	/**
	* 克隆对象
	**/
	public TbPartnerConfig clone(){
		TbPartnerConfig clone = new TbPartnerConfig();
		
			
			
		clone.tbpcBrand=this.tbpcBrand;
		
			
		clone.tbpcCardName=this.tbpcCardName;
		
			
		clone.tbpcPrice=this.tbpcPrice;
		
			
		clone.tbpcProducts=this.tbpcProducts;
		
			
		clone.tbpcPtJj=this.tbpcPtJj;
		
			
		clone.tbpcPtZhj=this.tbpcPtZhj;
		
			
		clone.tbpcDlJj=this.tbpcDlJj;
		
			
		clone.tbpcDlZhj=this.tbpcDlZhj;
		
			
		clone.tbpcValidity=this.tbpcValidity;
		
			
		clone.tbpcMoney=this.tbpcMoney;
		
			
		clone.tbpcZcGsh=this.tbpcZcGsh;
		
			
		clone.tbpcXy=this.tbpcXy;
		
			
		clone.tbpcFxZc=this.tbpcFxZc;
		
			
		clone.tbpcQyJsh=this.tbpcQyJsh;
		
			
		clone.tbpcJrTj=this.tbpcJrTj;
		
			
		clone.tbpcHhrQy=this.tbpcHhrQy;
		
			
		clone.tbpcQrCode=this.tbpcQrCode;
		
		return clone;
	}
	
	
	
	
	
	/**
	 * 根据ID取合伙人卡配置
	 * @param id
	 * @return
	 */
	public static @api TbPartnerConfig get(Long id){		
		return getTbPartnerConfigById(id);
	}
	
	
	/**
	 * 设置ID
	 * @param id
	 * @return
	 */
	public void setId(Long id){		
		this.tbpcId = id;
	}
	
	
	/**
	 * 获取所有合伙人卡配置
	 * @return
	 */
	public static @api List<TbPartnerConfig> list(Map params,Integer size){
		return getTbPartnerConfigList(params,size);
	}
	/**
	 * 获取合伙人卡配置分页
	 * @return
	 */
	public static @api Page<TbPartnerConfig> page(Integer page,Integer size,Map params){
		return getTbPartnerConfigPage(page, size , params);
	}
	
	
	/**
	 * 根据查询条件取合伙人卡配置
	 * @param params
	 * @return
	 */
	public static @api TbPartnerConfig Get(Map params){
		return getTbPartnerConfig(params);
	}
	/**
	 * 获取合伙人卡配置数
	 * @return
	 */
	public static @api Long count(Map params){
		return getTbPartnerConfigCount(params);
	}
	/**
	 * 获取合伙人卡配置数
	 * @return
	 */
	public static @api <T> T eval(String eval,Map params){
		return getTbPartnerConfigEval(eval,params);
	}
	
	
	/**
	 * 获取合伙人卡配置图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> stats(Map params,C sumKey,C groupKey){
		return getTbPartnerConfigStats(params,sumKey,groupKey,-1);
	}
	/**
	 * 获取合伙人卡配置图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 分组的字段
	 * @param dateType 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> stats(Map params,C sumKey,C groupKey,int dateType){
		return getTbPartnerConfigStats(params,sumKey,groupKey,dateType);
	}
	
	
	/**
	 * 根据ID取合伙人卡配置
	 * @param id
	 * @return
	 */
	public static @api TbPartnerConfig getTbPartnerConfigById(Long id){		
		return getTbPartnerConfigDao().getTbPartnerConfigById(id);
	}
	
	
	/**
	 * 获取id
	 * @return
	 */
	public Long getId(){
		return this.tbpcId;
	}
	
	
	
	/**
	 * 根据ID取合伙人卡配置的标识键值
	 * @param id
	 * @return
	 */
	public static @api String getKeyValue(Object key){
		Long id = Utils.parseLong(key);	
		if(id==null || id.longValue()==0 ){
			
			return null;
			
		}
		String value = null;
		
		value = Cache.getValue(TbPartnerConfig.class, id);
				
		if(value==null){
			TbPartnerConfig tbPartnerConfig = get(id);
			if(tbPartnerConfig!=null){
				String strValue = tbPartnerConfig.getTbpcId$();
				
				
				Cache.setValue(TbPartnerConfig.class, id ,strValue);
				
				value = strValue;
			}else{
				
				Cache.setValue(TbPartnerConfig.class, id ,"{"+id+"}",30);
				
				value = "{"+id+"}";
			}
		}
		
		/************LAZY3Q_ID_KEYVALUE************/
		/************LAZY3Q_ID_KEYVALUE************/
		return value;
	}	
	
	
	/**
	 * 获取当前对象的键值
	 * @return
	 */
	public String getKeyValue(){
		
		/************LAZY3Q_CODE_KEYVALUE************/
		/************LAZY3Q_CODE_KEYVALUE************/
		String keyValue = this.getTbpcId$();
		
		return keyValue;
	}
	
	
	/**
	 * 根据关键字精确查询合伙人卡配置对象
	 * @return
	 */
	public static @api TbPartnerConfig find(String key){
		if(Utils.empty(key))return null;
		Map params = new HashMap();
		if(key.toLowerCase().startsWith("id:"))//如果查询条件以id:开头，则按ID查询
			params.put("tbpcId", key.toLowerCase().replaceFirst("id:", ""));					
		else{//按标识查询，精确查询
			String strDefinex = "";
			
			strDefinex="(2=1 "+strDefinex+")";
			params.put("definex",strDefinex);
		}
		
		/************LAZY3Q_CODE_FIND************/
		/************LAZY3Q_CODE_FIND************/
		return TbPartnerConfig.getTbPartnerConfig(params);
	}
	
	
	/**
	 * 根据关键字查询合伙人卡配置
	 * @return
	 */
	public static @api List<Map> query(String key,int size,Map params,Boolean bObject){
		if(Utils.empty((String)params.get("asc")) && Utils.empty((String)params.get("desc")))//如果未传入排序字段
			params.put("desc","tbpc_id");//那么，默认以主键降序，传给Dao层
		String strTerm=key;		
		if(!Utils.empty(strTerm)){
			if(strTerm.toLowerCase().startsWith("id:"))//如果查询条件以id:开头，则按ID查询
				params.put("tbpcId", strTerm.toLowerCase().replaceFirst("id:", ""));					
			else//按标识查询，模糊查询请带%
			{
				String strDefinex = "";
				
				strDefinex="(2=1 "+strDefinex+")";
				params.put("definex",strDefinex);
			}
		}
		
		
		/************LAZY3Q_CODE_QUERY************/
		/************LAZY3Q_CODE_QUERY************/
			
		List<TbPartnerConfig> list = page(0,size,params).getResult();
		
		/**
		* OK!取到数据拼成放入Map中，[{value,text,object:{...}},...]
		* value:数据ID，text:数据标识,object,整个对象
		**/
		List<Map> result = new java.util.ArrayList();
		for(TbPartnerConfig tbPartnerConfig:list){
			Map map = new HashMap();
			map.put("key",tbPartnerConfig.getTbpcId().toString());
			map.put("value", Utils.js(tbPartnerConfig.getKeyValue()));
			if(bObject==true)
				map.put("object",tbPartnerConfig);
			result.add(map);
		}
		
		
		/************LAZY3Q_AFTER_QUERY************/
		/************LAZY3Q_AFTER_QUERY************/
		
		return result;
	}
	
	
	
	/**
	 * 获取所有合伙人卡配置
	 * @return
	 */
	public static @api List<TbPartnerConfig> getTbPartnerConfigList(Map params,Integer size){
		return getTbPartnerConfigDao().getTbPartnerConfigList(params,0,size);
	}
	
	/**
	 * 获取合伙人卡配置分页
	 * @return
	 */
	public static @api Page<TbPartnerConfig> getTbPartnerConfigPage(Integer page,Integer size,Map params){
		if(page==null)page=0;
		if(size==null)size=20;
		return getTbPartnerConfigDao().getTbPartnerConfigPage(page, size , params);
	}
	
	/**
	 * 根据查询条件取合伙人卡配置
	 * @param params
	 * @return
	 */
	public static @api TbPartnerConfig getTbPartnerConfig(Map params){
		return getTbPartnerConfigDao().getTbPartnerConfig(params);
	}
	
	/**
	 * 保存一个合伙人卡配置
	 * @param tbPartnerConfig
	 * @return
	 */
	public static @api TbPartnerConfig saveTbPartnerConfig(TbPartnerConfig tbPartnerConfig){
		return getTbPartnerConfigDao().saveTbPartnerConfig(tbPartnerConfig);
	}
	
	/**
	 * 根据条件更新合伙人卡配置
	 * @param values
	 * @param params
	 */
	public static @api int updateTbPartnerConfigByConfirm(Map values, Map params){
		return getTbPartnerConfigDao().updateTbPartnerConfigByConfirm(values,params);
	}
	
	/**
	 * 修改一个合伙人卡配置
	 * @param tbPartnerConfig
	 * @return
	 */
	public static @api int updateTbPartnerConfig(TbPartnerConfig tbPartnerConfig){
		return getTbPartnerConfigDao().updateTbPartnerConfig(tbPartnerConfig);
	}
	
	/**
	 * 更新合伙人卡配置非空字段
	 * @param tbPartnerConfig
	 */
	public static @api int updateTbPartnerConfig$NotNull(TbPartnerConfig tbPartnerConfig){
		return getTbPartnerConfigDao().updateTbPartnerConfig$NotNull(tbPartnerConfig);
	}
	
	/**
	 * 获取合伙人卡配置数
	 * @return
	 */
	public static @api Long getTbPartnerConfigCount(Map params){
		return getTbPartnerConfigDao().getTbPartnerConfigCount(params);
	}
		
		
	/**
	 * 获取合伙人卡配置自定义求和表达式,比如求和:eval="sum(id)"
	 * @return
	 */	
	public static @api <T> T getTbPartnerConfigEval(String eval,Map params){
		return getTbPartnerConfigDao().getTbPartnerConfigEval(eval,params);
	}
	
	
	/**
	 * 获取合伙人卡配置图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 分组的字段
	 * @param dateType 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> getTbPartnerConfigStats(Map params,C sumKey,C groupKey,int dateType){
		//TODO:图表统计功能未实现
		
		Map<String,Object> groups=new HashMap();//要分组的字段
		Map<String,Object> sums=new HashMap();//要统计的字段
		
		String[][] dateFormats=new String[][]{
				null,
				new String[]{"%Y","yyyy年","Y"},
				new String[]{"%Y-%m","yyyy年MM月","M"},
				new String[]{"%Y%U","yyyy年第ww周","W"},
				new String[]{"%Y-%m-%d","yyyy年MM月dd日","D"},
				new String[]{"%Y-%m-%d %H","yyyy年MM月dd日 HH点","H"},
				new String[]{"%m","MM月"},
				new String[]{"%d","dd号"},
				new String[]{"%H","HH点"} 
		};
		
		//获取要分组的字段，放入Map中
		if(dateType>0){
			groups.put(groupKey.toString(),"DATE_FORMAT({key},'"+dateFormats[dateType][0]+"')");
		}else{
			groups.put(groupKey.toString(),"{key}");
		}
		if(dateType<6 && dateType>0){ 
			params.put("asc", groupKey.toString()); 
			if(params.get(groupKey.name()+"Start")==null){
				params.put(groupKey.name()+"Start", Utils.date(new Date(), -24, dateFormats[dateType][2]));
			}
		}
		
		
		//获取要统计的字段，放入Map中
		if(sumKey.toString().equals("count")){
			sums.put(sumKey.toString(),"count(*)");
		}else{
			sums.put(sumKey.toString(),"sum({key})");
		}
		
		List<Map> list = getTbPartnerConfigDao().getTbPartnerConfigStats(params,groups,sums);
		
		List<Map> result = new ArrayList();
		for(Map m:list){
			Map map = new HashMap();
			Object value = m.get(sumKey.toString());
			Object name = null;
			Object groupValue = m.get(groupKey.toString());
			if(dateType>0){
				name = Utils.date(Utils.parseDate(groupValue), dateFormats[dateType][1]);
			}else{
				try{
					java.lang.reflect.Method method = TbPartnerConfig.class.getMethod("get"+Utils.ForMat(groupKey.toString())+"$");
					method.setAccessible(true);
					name = method.invoke(TbPartnerConfig.fromMap(m));
				}catch(Exception ex){
					ex.printStackTrace();
				}
			}
			map.put("name", name);
			map.put("value", value);
			result.add(map);
		}
		return result;
	}
	
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static int updateTbPartnerConfig(Map set,Map where){
		if(set.isEmpty())throw new RuntimeException("set为空");
		if(where.isEmpty())throw new RuntimeException("where为空");
		where.put("confirm", "1");
		return getTbPartnerConfigDao().updateTbPartnerConfigByConfirm(set, where);
	}
	
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static void deleteTbPartnerConfig(Map where){
		if(where.isEmpty())throw new RuntimeException("where为空");
		where.put("confirm", "1");
		getTbPartnerConfigDao().deleteTbPartnerConfigByConfirm(where);
	}
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static void delete(Long id){
		if(id==null)throw new RuntimeException("id为空");
		
		getTbPartnerConfigDao().deleteTbPartnerConfigById(id);
		
	}
	
	
	/**
	 * 保存合伙人卡配置对象
	 * @param params
	 * @return
	 */
	public TbPartnerConfig save(){
		if(this.getTbpcId()!=null)
			getTbPartnerConfigDao().updateTbPartnerConfig(this);
		else
			return getTbPartnerConfigDao().saveTbPartnerConfig(this);
		return this;
	}
	
	
	/**
	 * 更新合伙人卡配置对象的非空字段,注意跟Service里面的update不一样哦
	 * @param params
	 * @return
	 */
	public int update(){
		return getTbPartnerConfigDao().updateTbPartnerConfig$NotNull(this);
	}
	
	
	/**
	 * 删除
	 * @param params
	 * @return
	 */
	public void delete(){
		
			getTbPartnerConfigDao().deleteTbPartnerConfigById(this.getTbpcId());
	}
	
	/**
	 * 执行事务
	 * @param function
	 */
	public static <T> T execute(Function function){
		return getTbPartnerConfigDao().executeTransaction(function);
	}

	
	
	/*******************************编号**********************************/	
	/**
	* 编号 [非空]      
	**/
	public Long getTbpcId(){
		
		if(this.tbpcId!=null){
			return this.tbpcId;
		}
		
		return this.tbpcId;
	}
	/**
	* 获取编号格式化(toString)
	**/
	public String getTbpcId$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbpcId());
	 
	 	 return strValue;
	}
	/**
	* 根据编号反格式化
	**/
	public void setTbpcId$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcId=null;
			return;
		}
	
	
	 	this.tbpcId=Utils.parseLong(strValue);
	 
	}
	
	/**
	* 编号 [非空]      
	**/
	public void setTbpcId(Long tbpcId){
		this.tbpcId = tbpcId;
		
		this.setSeted(F.tbpcId);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************品牌**********************************/	
	/**
	* 品牌  [Merchant]     
	**/
	public Long getTbpcBrand(){
		
		if(this.tbpcBrand!=null){
			return this.tbpcBrand;
		}
		
		return this.tbpcBrand;
	}
	/**
	* 获取品牌格式化(toString)
	**/
	public String getTbpcBrand$(){
		String strValue="";
	
	
		 
		if(this.getTbpcBrand()!=null){
			
				strValue+=Utils.string(Merchant.getKeyValue(this.getTbpcBrand()));
			
		}			
		 
	 
	 	 return strValue;
	}
	/**
	* 根据品牌反格式化
	**/
	public void setTbpcBrand$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcBrand=null;
			return;
		}
	
	
		 
		Merchant item = Merchant.find(strValue);
		if(item!=null){
			
			this.tbpcBrand = Utils.parseLong(item.getId());
			
		}
		 
	 
	}
	
	/**
	* 品牌  [Merchant]     
	**/
	public void setTbpcBrand(Long tbpcBrand){
		this.tbpcBrand = tbpcBrand;
		
		this.setSeted(F.tbpcBrand);
		
	}
	
	
		 
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 		
	/**
	* 获取关联对象[品牌信息]
	**/	 			
 	public Merchant get$tbpcBrand(){
 		if(this.$tbpcBrand!=null)
 			return this.$tbpcBrand;
 		com.distribute.framework.model.Merchant merchant = null;
		if(this.getTbpcBrand()!=null){
		
 			merchant = Merchant.get(this.getTbpcBrand());
 		
 		}
 		return merchant;
	}
	
 	
	
	
	/*******************************合伙人卡名称**********************************/	
	/**
	* 合伙人卡名称       
	**/
	public String getTbpcCardName(){
		
		if(this.tbpcCardName!=null){
			return this.tbpcCardName;
		}
		
		return this.tbpcCardName;
	}
	/**
	* 获取合伙人卡名称格式化(toString)
	**/
	public String getTbpcCardName$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbpcCardName());
	 
	 	 return strValue;
	}
	/**
	* 根据合伙人卡名称反格式化
	**/
	public void setTbpcCardName$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcCardName=null;
			return;
		}
	
	
	 	this.tbpcCardName=strValue;
	 
	}
	
	/**
	* 合伙人卡名称       
	**/
	public void setTbpcCardName(String tbpcCardName){
		this.tbpcCardName = tbpcCardName;
		
		this.setSeted(F.tbpcCardName);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************价格**********************************/	
	/**
	* 价格       
	**/
	public Double getTbpcPrice(){
		
		if(this.tbpcPrice!=null){
			return this.tbpcPrice;
		}
		
		return this.tbpcPrice;
	}
	/**
	* 获取价格格式化(toString)
	**/
	public String getTbpcPrice$(){
		String strValue="";
	
	
			
		 strValue=Utils.string(this.getTbpcPrice());	
			
	 
	 	 return strValue;
	}
	/**
	* 根据价格反格式化
	**/
	public void setTbpcPrice$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcPrice=null;
			return;
		}
	
	
	 	this.tbpcPrice=Utils.parseDouble(strValue);
	 
	}
	
	/**
	* 价格       
	**/
	public void setTbpcPrice(Double tbpcPrice){
		this.tbpcPrice = tbpcPrice;
		
		this.setSeted(F.tbpcPrice);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************产品配置**********************************/	
	/**
	* 产品配置    query:goods text:number money:price    
	**/
	public String getTbpcProducts(){
		
		if(this.tbpcProducts!=null){
			return this.tbpcProducts;
		}
		
		return this.tbpcProducts;
	}
	/**
	* 获取产品配置格式化(toString)
	**/
	public String getTbpcProducts$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbpcProducts());
	 
	 	 return strValue;
	}
	/**
	* 根据产品配置反格式化
	**/
	public void setTbpcProducts$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcProducts=null;
			return;
		}
	
	
		this.tbpcProducts=Utils.parseString(strValue);
	 
	}
	
	/**
	* 产品配置    query:goods text:number money:price    
	**/
	public void setTbpcProducts(String tbpcProducts){
		this.tbpcProducts = tbpcProducts;
		
		this.setSeted(F.tbpcProducts);
		
	}
	
	
	
	
	/**
	* 产品配置对应内部类
	**/
	public static class TbpcProducts implements java.io.Serializable{
		
		String goods;//关联商品  
		
		String number;//数量  
		
		String price;//价格  
		
		
		/** 关联商品   **/
		public void setGoods(String goods){
			this.goods=goods;
		}
		/** 关联商品   **/
		public String getGoods(){
			return this.goods;
		}
		
		/** 数量   **/
		public void setNumber(String number){
			this.number=number;
		}
		/** 数量   **/
		public String getNumber(){
			return this.number;
		}
		
		/** 价格   **/
		public void setPrice(String price){
			this.price=price;
		}
		/** 价格   **/
		public String getPrice(){
			return this.price;
		}
		
	}
	
	
	
	
	
	/**
	* 获取产品配置格式化列表
	**/ 			
 	public List<TbpcProducts> get$tbpcProducts(){
 		List<TbpcProducts> array = new ArrayList();
 		String strJson = this.tbpcProducts;
 		if(this.getSeted("tbpcProducts")==null || !this.getSeted("tbpcProducts")){
 			TbPartnerConfig dbTbPartnerConfig = TbPartnerConfig.get(this.tbpcId);
 			if(dbTbPartnerConfig!=null)
 				strJson = dbTbPartnerConfig.getTbpcProducts();
 		} 
 		List<Map> list = (List<Map>) (Utils.empty(strJson) ? null : Utils.eval(strJson));
 		if(list!=null){
	 		for(Map map:list){
	 			TbpcProducts tbpcProducts = new TbpcProducts();
	 			
	 			tbpcProducts.setGoods(Utils.parseString(map.get("goods")));
	 			
	 			tbpcProducts.setNumber(Utils.parseString(map.get("number")));
	 			
	 			tbpcProducts.setPrice(Utils.parseString(map.get("price")));
	 			
	 			array.add(tbpcProducts);
	 		}
 		}else{
 			list = new ArrayList();
 		}
 		return array;
 	}
 	public void addTbpcProducts(String goods,String number,String price){
 		TbpcProducts tbpcProducts = new TbpcProducts();
 		
 		tbpcProducts.setGoods(goods);
		
 		tbpcProducts.setNumber(number);
		
 		tbpcProducts.setPrice(price);
		
		this.addTbpcProducts(tbpcProducts);
 	}
 	public void addTbpcProducts(TbpcProducts tbpcProducts){
 		List<TbpcProducts> array = get$tbpcProducts();
 		array.add(tbpcProducts);
 		this.tbpcProducts = Utils.json(array);
 	}
 	
 	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************普通间接奖励**********************************/	
	/**
	* 普通间接奖励       
	**/
	public Double getTbpcPtJj(){
		
		if(this.tbpcPtJj!=null){
			return this.tbpcPtJj;
		}
		
		return this.tbpcPtJj;
	}
	/**
	* 获取普通间接奖励格式化(toString)
	**/
	public String getTbpcPtJj$(){
		String strValue="";
	
	
			
		 strValue=Utils.string(this.getTbpcPtJj());	
			
	 
	 	 return strValue;
	}
	/**
	* 根据普通间接奖励反格式化
	**/
	public void setTbpcPtJj$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcPtJj=null;
			return;
		}
	
	
	 	this.tbpcPtJj=Utils.parseDouble(strValue);
	 
	}
	
	/**
	* 普通间接奖励       
	**/
	public void setTbpcPtJj(Double tbpcPtJj){
		this.tbpcPtJj = tbpcPtJj;
		
		this.setSeted(F.tbpcPtJj);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************普通直接奖励**********************************/	
	/**
	* 普通直接奖励       
	**/
	public Double getTbpcPtZhj(){
		
		if(this.tbpcPtZhj!=null){
			return this.tbpcPtZhj;
		}
		
		return this.tbpcPtZhj;
	}
	/**
	* 获取普通直接奖励格式化(toString)
	**/
	public String getTbpcPtZhj$(){
		String strValue="";
	
	
			
		 strValue=Utils.string(this.getTbpcPtZhj());	
			
	 
	 	 return strValue;
	}
	/**
	* 根据普通直接奖励反格式化
	**/
	public void setTbpcPtZhj$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcPtZhj=null;
			return;
		}
	
	
	 	this.tbpcPtZhj=Utils.parseDouble(strValue);
	 
	}
	
	/**
	* 普通直接奖励       
	**/
	public void setTbpcPtZhj(Double tbpcPtZhj){
		this.tbpcPtZhj = tbpcPtZhj;
		
		this.setSeted(F.tbpcPtZhj);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************代理间接奖励**********************************/	
	/**
	* 代理间接奖励       
	**/
	public Double getTbpcDlJj(){
		
		if(this.tbpcDlJj!=null){
			return this.tbpcDlJj;
		}
		
		return this.tbpcDlJj;
	}
	/**
	* 获取代理间接奖励格式化(toString)
	**/
	public String getTbpcDlJj$(){
		String strValue="";
	
	
			
		 strValue=Utils.string(this.getTbpcDlJj());	
			
	 
	 	 return strValue;
	}
	/**
	* 根据代理间接奖励反格式化
	**/
	public void setTbpcDlJj$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcDlJj=null;
			return;
		}
	
	
	 	this.tbpcDlJj=Utils.parseDouble(strValue);
	 
	}
	
	/**
	* 代理间接奖励       
	**/
	public void setTbpcDlJj(Double tbpcDlJj){
		this.tbpcDlJj = tbpcDlJj;
		
		this.setSeted(F.tbpcDlJj);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************代理直接奖励**********************************/	
	/**
	* 代理直接奖励       
	**/
	public Double getTbpcDlZhj(){
		
		if(this.tbpcDlZhj!=null){
			return this.tbpcDlZhj;
		}
		
		return this.tbpcDlZhj;
	}
	/**
	* 获取代理直接奖励格式化(toString)
	**/
	public String getTbpcDlZhj$(){
		String strValue="";
	
	
			
		 strValue=Utils.string(this.getTbpcDlZhj());	
			
	 
	 	 return strValue;
	}
	/**
	* 根据代理直接奖励反格式化
	**/
	public void setTbpcDlZhj$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcDlZhj=null;
			return;
		}
	
	
	 	this.tbpcDlZhj=Utils.parseDouble(strValue);
	 
	}
	
	/**
	* 代理直接奖励       
	**/
	public void setTbpcDlZhj(Double tbpcDlZhj){
		this.tbpcDlZhj = tbpcDlZhj;
		
		this.setSeted(F.tbpcDlZhj);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************合伙人有效期**********************************/	
	/**
	* 合伙人有效期     已月为单位12 代表12个月后失效  
	**/
	public Integer getTbpcValidity(){
		
		if(this.tbpcValidity!=null){
			return this.tbpcValidity;
		}
		
		return this.tbpcValidity;
	}
	/**
	* 获取合伙人有效期格式化(toString)
	**/
	public String getTbpcValidity$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbpcValidity());
	 
	 	 return strValue;
	}
	/**
	* 根据合伙人有效期反格式化
	**/
	public void setTbpcValidity$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcValidity=null;
			return;
		}
	
	
	 	this.tbpcValidity=Utils.parseInteger(strValue);
	 
	}
	
	/**
	* 合伙人有效期     已月为单位12 代表12个月后失效  
	**/
	public void setTbpcValidity(Integer tbpcValidity){
		this.tbpcValidity = tbpcValidity;
		
		this.setSeted(F.tbpcValidity);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************续期订单总额**********************************/	
	/**
	* 续期订单总额     总金额大于设置的金额，要到期的时候自动续有效期。  
	**/
	public Double getTbpcMoney(){
		
		if(this.tbpcMoney!=null){
			return this.tbpcMoney;
		}
		
		return this.tbpcMoney;
	}
	/**
	* 获取续期订单总额格式化(toString)
	**/
	public String getTbpcMoney$(){
		String strValue="";
	
	
			
		 strValue=Utils.string(this.getTbpcMoney());	
			
	 
	 	 return strValue;
	}
	/**
	* 根据续期订单总额反格式化
	**/
	public void setTbpcMoney$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcMoney=null;
			return;
		}
	
	
	 	this.tbpcMoney=Utils.parseDouble(strValue);
	 
	}
	
	/**
	* 续期订单总额     总金额大于设置的金额，要到期的时候自动续有效期。  
	**/
	public void setTbpcMoney(Double tbpcMoney){
		this.tbpcMoney = tbpcMoney;
		
		this.setSeted(F.tbpcMoney);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************政策概述**********************************/	
	/**
	* 政策概述       
	**/
	public String getTbpcZcGsh(){
		
		if(this.tbpcZcGsh!=null){
			return this.tbpcZcGsh;
		}
		
		return this.tbpcZcGsh;
	}
	/**
	* 获取政策概述格式化(toString)
	**/
	public String getTbpcZcGsh$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbpcZcGsh());
	 
	 	 return strValue;
	}
	/**
	* 根据政策概述反格式化
	**/
	public void setTbpcZcGsh$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcZcGsh=null;
			return;
		}
	
	
		this.tbpcZcGsh=strValue;
	 
	}
	
	/**
	* 政策概述       
	**/
	public void setTbpcZcGsh(String tbpcZcGsh){
		this.tbpcZcGsh = tbpcZcGsh;
		
		this.setSeted(F.tbpcZcGsh);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************协议**********************************/	
	/**
	* 协议       
	**/
	public String getTbpcXy(){
		
		if(this.tbpcXy!=null){
			return this.tbpcXy;
		}
		
		return this.tbpcXy;
	}
	/**
	* 获取协议格式化(toString)
	**/
	public String getTbpcXy$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbpcXy());
	 
	 	 return strValue;
	}
	/**
	* 根据协议反格式化
	**/
	public void setTbpcXy$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcXy=null;
			return;
		}
	
	
		this.tbpcXy=strValue;
	 
	}
	
	/**
	* 协议       
	**/
	public void setTbpcXy(String tbpcXy){
		this.tbpcXy = tbpcXy;
		
		this.setSeted(F.tbpcXy);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************奖励政策**********************************/	
	/**
	* 奖励政策       
	**/
	public String getTbpcFxZc(){
		
		if(this.tbpcFxZc!=null){
			return this.tbpcFxZc;
		}
		
		return this.tbpcFxZc;
	}
	/**
	* 获取奖励政策格式化(toString)
	**/
	public String getTbpcFxZc$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbpcFxZc());
	 
	 	 return strValue;
	}
	/**
	* 根据奖励政策反格式化
	**/
	public void setTbpcFxZc$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcFxZc=null;
			return;
		}
	
	
		this.tbpcFxZc=strValue;
	 
	}
	
	/**
	* 奖励政策       
	**/
	public void setTbpcFxZc(String tbpcFxZc){
		this.tbpcFxZc = tbpcFxZc;
		
		this.setSeted(F.tbpcFxZc);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************权益介绍**********************************/	
	/**
	* 权益介绍       
	**/
	public String getTbpcQyJsh(){
		
		if(this.tbpcQyJsh!=null){
			return this.tbpcQyJsh;
		}
		
		return this.tbpcQyJsh;
	}
	/**
	* 获取权益介绍格式化(toString)
	**/
	public String getTbpcQyJsh$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbpcQyJsh());
	 
	 	 return strValue;
	}
	/**
	* 根据权益介绍反格式化
	**/
	public void setTbpcQyJsh$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcQyJsh=null;
			return;
		}
	
	
		this.tbpcQyJsh=strValue;
	 
	}
	
	/**
	* 权益介绍       
	**/
	public void setTbpcQyJsh(String tbpcQyJsh){
		this.tbpcQyJsh = tbpcQyJsh;
		
		this.setSeted(F.tbpcQyJsh);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************加入条件**********************************/	
	/**
	* 加入条件       
	**/
	public String getTbpcJrTj(){
		
		if(this.tbpcJrTj!=null){
			return this.tbpcJrTj;
		}
		
		return this.tbpcJrTj;
	}
	/**
	* 获取加入条件格式化(toString)
	**/
	public String getTbpcJrTj$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbpcJrTj());
	 
	 	 return strValue;
	}
	/**
	* 根据加入条件反格式化
	**/
	public void setTbpcJrTj$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcJrTj=null;
			return;
		}
	
	
		this.tbpcJrTj=strValue;
	 
	}
	
	/**
	* 加入条件       
	**/
	public void setTbpcJrTj(String tbpcJrTj){
		this.tbpcJrTj = tbpcJrTj;
		
		this.setSeted(F.tbpcJrTj);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************合伙人权益介绍**********************************/	
	/**
	* 合伙人权益介绍       
	**/
	public String getTbpcHhrQy(){
		
		if(this.tbpcHhrQy!=null){
			return this.tbpcHhrQy;
		}
		
		return this.tbpcHhrQy;
	}
	/**
	* 获取合伙人权益介绍格式化(toString)
	**/
	public String getTbpcHhrQy$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbpcHhrQy());
	 
	 	 return strValue;
	}
	/**
	* 根据合伙人权益介绍反格式化
	**/
	public void setTbpcHhrQy$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcHhrQy=null;
			return;
		}
	
	
		this.tbpcHhrQy=strValue;
	 
	}
	
	/**
	* 合伙人权益介绍       
	**/
	public void setTbpcHhrQy(String tbpcHhrQy){
		this.tbpcHhrQy = tbpcHhrQy;
		
		this.setSeted(F.tbpcHhrQy);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************二维码**********************************/	
	/**
	* 二维码       
	**/
	public String getTbpcQrCode(){
		
		if(this.tbpcQrCode!=null){
			return this.tbpcQrCode;
		}
		
		return this.tbpcQrCode;
	}
	/**
	* 获取二维码格式化(toString)
	**/
	public String getTbpcQrCode$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbpcQrCode());
	 
	 	 return strValue;
	}
	/**
	* 根据二维码反格式化
	**/
	public void setTbpcQrCode$(String strValue){
		if(Utils.empty(strValue)){
			this.tbpcQrCode=null;
			return;
		}
	
	
		this.tbpcQrCode=Utils.parseString(strValue);
	 
	}
	
	/**
	* 二维码       
	**/
	public void setTbpcQrCode(String tbpcQrCode){
		this.tbpcQrCode = tbpcQrCode;
		
		this.setSeted(F.tbpcQrCode);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	
	/************LAZY3Q_DEFINE_CODE************/
	/************LAZY3Q_DEFINE_CODE************/	
	
	
	/**
	 * 触发器
	 */
	public static void on(Trigger.Index index,final Notify.Listener listener,Trigger.Type... types){
		Notify.on(TbPartnerConfig.class, index, listener, types);
	}
	public static void on(final Notify.Listener listener,String type){
		Notify.on(TbPartnerConfig.class, listener, type);
	}
	/**
	 * 当修改字段时
	 * @param filedName
	 * @param listener
	 */
	public static void on(String filedName,final Notify.Listener listener){
		Notify.on(TbPartnerConfig.class, listener, filedName);
	}
	/**
	 * 当修改字段为某值时
	 * @param filedName
	 * @param value
	 * @param listener
	 */
	public static void on(String filedName,Object value,final Notify.Listener listener){
		if(value==null)return;
		Notify.on(TbPartnerConfig.class, listener, filedName+"."+Utils.md5(""+value));
	}
	public void notify(String type){
		Trigger.on(TbPartnerConfig.class,type, this);
	}
	
	
	/**
	 * 用来获取当有字段关联对象时的获取方式,调用如${TbPartnerConfig.obj.filedName}
	 * 因为有些变态的模板语言不能识别$，所以不能以${TbPartnerConfig.$filedName}获取关联对象
	 */
	public Map getObj(){
		return new HashMap(){
			@Override
			public Object get(Object key) {
				try {
					return TbPartnerConfig.class.getMethod("get$"+Utils.forMat(key.toString())).invoke(TbPartnerConfig.this);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return null;
			}
		};
	}
	/**
	 * 用来获取某字段格式化的获取方式,调用如${TbPartnerConfig.fmt.filedName}
	 * 因为有些变态的模板语言不能识别$，所以不能以${TbPartnerConfig.filedName$}获取某字段格式化
	 */
	public Map getFmt(){
		return new HashMap(){
			@Override
			public Object get(Object key) {
				try {
					return TbPartnerConfig.class.getMethod("get"+Utils.ForMat(key.toString()+"$")).invoke(TbPartnerConfig.this);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return null;
			}
		};
	}
	/**
	 * 获取查询参数链式串
	 * @return
	 */
	public static @Deprecated M where(){ return new M(0); }
	public static @Deprecated M m(){ return new M(0); }
	public static M where = new M(0,true);
	public static @database(DatabaseNames.distribute_sys) class M extends IbatisMap{
		int type = 0; 
		M linked = null;
		Boolean proxy = false;
		public M set = null;
		public M(int type){
			this.type = type;
			if(this.type==0){
				set = new M(1,true);
				set.linked = this;
			}
		};
		public M(int type,Boolean proxy){
			this.type = type;
			this.proxy=proxy;
		};
		public M proxy(){
			M m = new M(this.type);//当前的对像
			if(this.type==0){
				m.set = new M(1,true);//set对象
				m.set.linked = m;
			}else{
				m.linked=this.linked;
				this.linked.linked=m;
			}
			return m;
		}
		public @Deprecated M set(){			
			M m = this;
			m.linked=new M(1);
			m.linked.linked=m;
			return m.linked;
		};
		
		public M on(IbatisMap value,C column,String joinColumn){if(proxy)return proxy().on(value,column,joinColumn);this.put(value.getClass().getDeclaringClass().getSimpleName(), value);value.put("on", column.toString());value.put("to", joinColumn);return this;};
		
		
			
		
		/** 编号 [非空]       **/
		public M tbpcId(Object tbpcId){if(proxy)return proxy().tbpcId(tbpcId);  this.put("tbpcId", tbpcId);return this;};
	 	/** and tbpc_id is null */
 		public M tbpcIdNull(){if(proxy)return proxy().tbpcIdNull();if(this.get("tbpcIdNot")==null)this.put("tbpcIdNot", "");this.put("tbpcId", null);return this;};
 		/** not .... */
 		public M tbpcIdNot(){if(proxy)return proxy().tbpcIdNot();this.put("tbpcIdNot", "not");return this;};
 		public M tbpcIdNotNull(){if(proxy)return proxy().tbpcIdNotNull();this.put("tbpcIdNot", "not");this.put("tbpcId", null);return this;};
 		public M tbpcIdNot(Object tbpcId){if(proxy)return proxy().tbpcIdNot(tbpcId);this.put("tbpcIdNot", "not");this.put("tbpcId", tbpcId);return this;};
	 		
		/** and tbpc_id <= ? */
		public M tbpcIdMin(Object min){if(proxy)return proxy().tbpcIdMin(min);this.put("tbpcIdMin", min);return this;};
		/** and tbpc_id >= ? */
		public M tbpcIdMax(Object max){if(proxy)return proxy().tbpcIdMax(max);this.put("tbpcIdMax", max);return this;};
			
			
		public M tbpcIdIn(String ids){
			if(proxy)return proxy().tbpcIdIn(ids);  this.put("tbpcIdIn", ids);return this;
		};	
 			
		
			
	 	
			
		public M tbpcBrand$on(Merchant.M value){if(proxy)return proxy().tbpcBrand$on(value);this.put("TbpcBrand", value);value.put("on", "tbpc_brand");return this;};
 				
 			
		
		/** 品牌  [Merchant]      **/
		public M tbpcBrand(Object tbpcBrand){if(proxy)return proxy().tbpcBrand(tbpcBrand);  this.put("tbpcBrand", tbpcBrand);return this;};
	 	/** and tbpc_brand is null */
 		public M tbpcBrandNull(){if(proxy)return proxy().tbpcBrandNull();if(this.get("tbpcBrandNot")==null)this.put("tbpcBrandNot", "");this.put("tbpcBrand", null);return this;};
 		/** not .... */
 		public M tbpcBrandNot(){if(proxy)return proxy().tbpcBrandNot();this.put("tbpcBrandNot", "not");return this;};
 		public M tbpcBrandNotNull(){if(proxy)return proxy().tbpcBrandNotNull();this.put("tbpcBrandNot", "not");this.put("tbpcBrand", null);return this;};
 		public M tbpcBrandNot(Object tbpcBrand){if(proxy)return proxy().tbpcBrandNot(tbpcBrand);this.put("tbpcBrandNot", "not");this.put("tbpcBrand", tbpcBrand);return this;};
	 		
			
		public M tbpcBrandIn(String ids){
			if(proxy)return proxy().tbpcBrandIn(ids);  this.put("tbpcBrandIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 合伙人卡名称        **/
		public M tbpcCardName(Object tbpcCardName){if(proxy)return proxy().tbpcCardName(tbpcCardName);  this.put("tbpcCardName", tbpcCardName);return this;};
	 	/** and tbpc_card_name is null */
 		public M tbpcCardNameNull(){if(proxy)return proxy().tbpcCardNameNull();if(this.get("tbpcCardNameNot")==null)this.put("tbpcCardNameNot", "");this.put("tbpcCardName", null);return this;};
 		/** not .... */
 		public M tbpcCardNameNot(){if(proxy)return proxy().tbpcCardNameNot();this.put("tbpcCardNameNot", "not");return this;};
 		public M tbpcCardNameNotNull(){if(proxy)return proxy().tbpcCardNameNotNull();this.put("tbpcCardNameNot", "not");this.put("tbpcCardName", null);return this;};
 		public M tbpcCardNameNot(Object tbpcCardName){if(proxy)return proxy().tbpcCardNameNot(tbpcCardName);this.put("tbpcCardNameNot", "not");this.put("tbpcCardName", tbpcCardName);return this;};
	 		
			
		
			
	 	
			
		
		/** 价格        **/
		public M tbpcPrice(Object tbpcPrice){if(proxy)return proxy().tbpcPrice(tbpcPrice);  this.put("tbpcPrice", tbpcPrice);return this;};
	 	/** and tbpc_price is null */
 		public M tbpcPriceNull(){if(proxy)return proxy().tbpcPriceNull();if(this.get("tbpcPriceNot")==null)this.put("tbpcPriceNot", "");this.put("tbpcPrice", null);return this;};
 		/** not .... */
 		public M tbpcPriceNot(){if(proxy)return proxy().tbpcPriceNot();this.put("tbpcPriceNot", "not");return this;};
 		public M tbpcPriceNotNull(){if(proxy)return proxy().tbpcPriceNotNull();this.put("tbpcPriceNot", "not");this.put("tbpcPrice", null);return this;};
 		public M tbpcPriceNot(Object tbpcPrice){if(proxy)return proxy().tbpcPriceNot(tbpcPrice);this.put("tbpcPriceNot", "not");this.put("tbpcPrice", tbpcPrice);return this;};
	 		
		/** and tbpc_price <= ? */
		public M tbpcPriceMin(Object min){if(proxy)return proxy().tbpcPriceMin(min);this.put("tbpcPriceMin", min);return this;};
		/** and tbpc_price >= ? */
		public M tbpcPriceMax(Object max){if(proxy)return proxy().tbpcPriceMax(max);this.put("tbpcPriceMax", max);return this;};
			
			
		
			
	 	
			
		
		/** 产品配置    query:goods text:number money:price     **/
		public M tbpcProducts(Object tbpcProducts){if(proxy)return proxy().tbpcProducts(tbpcProducts);  this.put("tbpcProducts", tbpcProducts);return this;};
	 	/** and tbpc_products is null */
 		public M tbpcProductsNull(){if(proxy)return proxy().tbpcProductsNull();if(this.get("tbpcProductsNot")==null)this.put("tbpcProductsNot", "");this.put("tbpcProducts", null);return this;};
 		/** not .... */
 		public M tbpcProductsNot(){if(proxy)return proxy().tbpcProductsNot();this.put("tbpcProductsNot", "not");return this;};
 		public M tbpcProductsNotNull(){if(proxy)return proxy().tbpcProductsNotNull();this.put("tbpcProductsNot", "not");this.put("tbpcProducts", null);return this;};
 		public M tbpcProductsNot(Object tbpcProducts){if(proxy)return proxy().tbpcProductsNot(tbpcProducts);this.put("tbpcProductsNot", "not");this.put("tbpcProducts", tbpcProducts);return this;};
	 		
			
		
			
	 	
			
		
		/** 普通间接奖励        **/
		public M tbpcPtJj(Object tbpcPtJj){if(proxy)return proxy().tbpcPtJj(tbpcPtJj);  this.put("tbpcPtJj", tbpcPtJj);return this;};
	 	/** and tbpc_pt_jj is null */
 		public M tbpcPtJjNull(){if(proxy)return proxy().tbpcPtJjNull();if(this.get("tbpcPtJjNot")==null)this.put("tbpcPtJjNot", "");this.put("tbpcPtJj", null);return this;};
 		/** not .... */
 		public M tbpcPtJjNot(){if(proxy)return proxy().tbpcPtJjNot();this.put("tbpcPtJjNot", "not");return this;};
 		public M tbpcPtJjNotNull(){if(proxy)return proxy().tbpcPtJjNotNull();this.put("tbpcPtJjNot", "not");this.put("tbpcPtJj", null);return this;};
 		public M tbpcPtJjNot(Object tbpcPtJj){if(proxy)return proxy().tbpcPtJjNot(tbpcPtJj);this.put("tbpcPtJjNot", "not");this.put("tbpcPtJj", tbpcPtJj);return this;};
	 		
		/** and tbpc_pt_jj <= ? */
		public M tbpcPtJjMin(Object min){if(proxy)return proxy().tbpcPtJjMin(min);this.put("tbpcPtJjMin", min);return this;};
		/** and tbpc_pt_jj >= ? */
		public M tbpcPtJjMax(Object max){if(proxy)return proxy().tbpcPtJjMax(max);this.put("tbpcPtJjMax", max);return this;};
			
			
		
			
	 	
			
		
		/** 普通直接奖励        **/
		public M tbpcPtZhj(Object tbpcPtZhj){if(proxy)return proxy().tbpcPtZhj(tbpcPtZhj);  this.put("tbpcPtZhj", tbpcPtZhj);return this;};
	 	/** and tbpc_pt_zhj is null */
 		public M tbpcPtZhjNull(){if(proxy)return proxy().tbpcPtZhjNull();if(this.get("tbpcPtZhjNot")==null)this.put("tbpcPtZhjNot", "");this.put("tbpcPtZhj", null);return this;};
 		/** not .... */
 		public M tbpcPtZhjNot(){if(proxy)return proxy().tbpcPtZhjNot();this.put("tbpcPtZhjNot", "not");return this;};
 		public M tbpcPtZhjNotNull(){if(proxy)return proxy().tbpcPtZhjNotNull();this.put("tbpcPtZhjNot", "not");this.put("tbpcPtZhj", null);return this;};
 		public M tbpcPtZhjNot(Object tbpcPtZhj){if(proxy)return proxy().tbpcPtZhjNot(tbpcPtZhj);this.put("tbpcPtZhjNot", "not");this.put("tbpcPtZhj", tbpcPtZhj);return this;};
	 		
		/** and tbpc_pt_zhj <= ? */
		public M tbpcPtZhjMin(Object min){if(proxy)return proxy().tbpcPtZhjMin(min);this.put("tbpcPtZhjMin", min);return this;};
		/** and tbpc_pt_zhj >= ? */
		public M tbpcPtZhjMax(Object max){if(proxy)return proxy().tbpcPtZhjMax(max);this.put("tbpcPtZhjMax", max);return this;};
			
			
		
			
	 	
			
		
		/** 代理间接奖励        **/
		public M tbpcDlJj(Object tbpcDlJj){if(proxy)return proxy().tbpcDlJj(tbpcDlJj);  this.put("tbpcDlJj", tbpcDlJj);return this;};
	 	/** and tbpc_dl_jj is null */
 		public M tbpcDlJjNull(){if(proxy)return proxy().tbpcDlJjNull();if(this.get("tbpcDlJjNot")==null)this.put("tbpcDlJjNot", "");this.put("tbpcDlJj", null);return this;};
 		/** not .... */
 		public M tbpcDlJjNot(){if(proxy)return proxy().tbpcDlJjNot();this.put("tbpcDlJjNot", "not");return this;};
 		public M tbpcDlJjNotNull(){if(proxy)return proxy().tbpcDlJjNotNull();this.put("tbpcDlJjNot", "not");this.put("tbpcDlJj", null);return this;};
 		public M tbpcDlJjNot(Object tbpcDlJj){if(proxy)return proxy().tbpcDlJjNot(tbpcDlJj);this.put("tbpcDlJjNot", "not");this.put("tbpcDlJj", tbpcDlJj);return this;};
	 		
		/** and tbpc_dl_jj <= ? */
		public M tbpcDlJjMin(Object min){if(proxy)return proxy().tbpcDlJjMin(min);this.put("tbpcDlJjMin", min);return this;};
		/** and tbpc_dl_jj >= ? */
		public M tbpcDlJjMax(Object max){if(proxy)return proxy().tbpcDlJjMax(max);this.put("tbpcDlJjMax", max);return this;};
			
			
		
			
	 	
			
		
		/** 代理直接奖励        **/
		public M tbpcDlZhj(Object tbpcDlZhj){if(proxy)return proxy().tbpcDlZhj(tbpcDlZhj);  this.put("tbpcDlZhj", tbpcDlZhj);return this;};
	 	/** and tbpc_dl_zhj is null */
 		public M tbpcDlZhjNull(){if(proxy)return proxy().tbpcDlZhjNull();if(this.get("tbpcDlZhjNot")==null)this.put("tbpcDlZhjNot", "");this.put("tbpcDlZhj", null);return this;};
 		/** not .... */
 		public M tbpcDlZhjNot(){if(proxy)return proxy().tbpcDlZhjNot();this.put("tbpcDlZhjNot", "not");return this;};
 		public M tbpcDlZhjNotNull(){if(proxy)return proxy().tbpcDlZhjNotNull();this.put("tbpcDlZhjNot", "not");this.put("tbpcDlZhj", null);return this;};
 		public M tbpcDlZhjNot(Object tbpcDlZhj){if(proxy)return proxy().tbpcDlZhjNot(tbpcDlZhj);this.put("tbpcDlZhjNot", "not");this.put("tbpcDlZhj", tbpcDlZhj);return this;};
	 		
		/** and tbpc_dl_zhj <= ? */
		public M tbpcDlZhjMin(Object min){if(proxy)return proxy().tbpcDlZhjMin(min);this.put("tbpcDlZhjMin", min);return this;};
		/** and tbpc_dl_zhj >= ? */
		public M tbpcDlZhjMax(Object max){if(proxy)return proxy().tbpcDlZhjMax(max);this.put("tbpcDlZhjMax", max);return this;};
			
			
		
			
	 	
			
		
		/** 合伙人有效期     已月为单位12 代表12个月后失效   **/
		public M tbpcValidity(Object tbpcValidity){if(proxy)return proxy().tbpcValidity(tbpcValidity);  this.put("tbpcValidity", tbpcValidity);return this;};
	 	/** and tbpc_validity is null */
 		public M tbpcValidityNull(){if(proxy)return proxy().tbpcValidityNull();if(this.get("tbpcValidityNot")==null)this.put("tbpcValidityNot", "");this.put("tbpcValidity", null);return this;};
 		/** not .... */
 		public M tbpcValidityNot(){if(proxy)return proxy().tbpcValidityNot();this.put("tbpcValidityNot", "not");return this;};
 		public M tbpcValidityNotNull(){if(proxy)return proxy().tbpcValidityNotNull();this.put("tbpcValidityNot", "not");this.put("tbpcValidity", null);return this;};
 		public M tbpcValidityNot(Object tbpcValidity){if(proxy)return proxy().tbpcValidityNot(tbpcValidity);this.put("tbpcValidityNot", "not");this.put("tbpcValidity", tbpcValidity);return this;};
	 		
		/** and tbpc_validity <= ? */
		public M tbpcValidityMin(Object min){if(proxy)return proxy().tbpcValidityMin(min);this.put("tbpcValidityMin", min);return this;};
		/** and tbpc_validity >= ? */
		public M tbpcValidityMax(Object max){if(proxy)return proxy().tbpcValidityMax(max);this.put("tbpcValidityMax", max);return this;};
			
			
		public M tbpcValidityIn(String ids){
			if(proxy)return proxy().tbpcValidityIn(ids);  this.put("tbpcValidityIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 续期订单总额     总金额大于设置的金额，要到期的时候自动续有效期。   **/
		public M tbpcMoney(Object tbpcMoney){if(proxy)return proxy().tbpcMoney(tbpcMoney);  this.put("tbpcMoney", tbpcMoney);return this;};
	 	/** and tbpc_money is null */
 		public M tbpcMoneyNull(){if(proxy)return proxy().tbpcMoneyNull();if(this.get("tbpcMoneyNot")==null)this.put("tbpcMoneyNot", "");this.put("tbpcMoney", null);return this;};
 		/** not .... */
 		public M tbpcMoneyNot(){if(proxy)return proxy().tbpcMoneyNot();this.put("tbpcMoneyNot", "not");return this;};
 		public M tbpcMoneyNotNull(){if(proxy)return proxy().tbpcMoneyNotNull();this.put("tbpcMoneyNot", "not");this.put("tbpcMoney", null);return this;};
 		public M tbpcMoneyNot(Object tbpcMoney){if(proxy)return proxy().tbpcMoneyNot(tbpcMoney);this.put("tbpcMoneyNot", "not");this.put("tbpcMoney", tbpcMoney);return this;};
	 		
		/** and tbpc_money <= ? */
		public M tbpcMoneyMin(Object min){if(proxy)return proxy().tbpcMoneyMin(min);this.put("tbpcMoneyMin", min);return this;};
		/** and tbpc_money >= ? */
		public M tbpcMoneyMax(Object max){if(proxy)return proxy().tbpcMoneyMax(max);this.put("tbpcMoneyMax", max);return this;};
			
			
		
			
	 	
			
		
		/** 政策概述        **/
		public M tbpcZcGsh(Object tbpcZcGsh){if(proxy)return proxy().tbpcZcGsh(tbpcZcGsh);  this.put("tbpcZcGsh", tbpcZcGsh);return this;};
	 	/** and tbpc_zc_gsh is null */
 		public M tbpcZcGshNull(){if(proxy)return proxy().tbpcZcGshNull();if(this.get("tbpcZcGshNot")==null)this.put("tbpcZcGshNot", "");this.put("tbpcZcGsh", null);return this;};
 		/** not .... */
 		public M tbpcZcGshNot(){if(proxy)return proxy().tbpcZcGshNot();this.put("tbpcZcGshNot", "not");return this;};
 		public M tbpcZcGshNotNull(){if(proxy)return proxy().tbpcZcGshNotNull();this.put("tbpcZcGshNot", "not");this.put("tbpcZcGsh", null);return this;};
 		public M tbpcZcGshNot(Object tbpcZcGsh){if(proxy)return proxy().tbpcZcGshNot(tbpcZcGsh);this.put("tbpcZcGshNot", "not");this.put("tbpcZcGsh", tbpcZcGsh);return this;};
	 		
			
		
			
	 	
			
		
		/** 协议        **/
		public M tbpcXy(Object tbpcXy){if(proxy)return proxy().tbpcXy(tbpcXy);  this.put("tbpcXy", tbpcXy);return this;};
	 	/** and tbpc_xy is null */
 		public M tbpcXyNull(){if(proxy)return proxy().tbpcXyNull();if(this.get("tbpcXyNot")==null)this.put("tbpcXyNot", "");this.put("tbpcXy", null);return this;};
 		/** not .... */
 		public M tbpcXyNot(){if(proxy)return proxy().tbpcXyNot();this.put("tbpcXyNot", "not");return this;};
 		public M tbpcXyNotNull(){if(proxy)return proxy().tbpcXyNotNull();this.put("tbpcXyNot", "not");this.put("tbpcXy", null);return this;};
 		public M tbpcXyNot(Object tbpcXy){if(proxy)return proxy().tbpcXyNot(tbpcXy);this.put("tbpcXyNot", "not");this.put("tbpcXy", tbpcXy);return this;};
	 		
			
		
			
	 	
			
		
		/** 奖励政策        **/
		public M tbpcFxZc(Object tbpcFxZc){if(proxy)return proxy().tbpcFxZc(tbpcFxZc);  this.put("tbpcFxZc", tbpcFxZc);return this;};
	 	/** and tbpc_fx_zc is null */
 		public M tbpcFxZcNull(){if(proxy)return proxy().tbpcFxZcNull();if(this.get("tbpcFxZcNot")==null)this.put("tbpcFxZcNot", "");this.put("tbpcFxZc", null);return this;};
 		/** not .... */
 		public M tbpcFxZcNot(){if(proxy)return proxy().tbpcFxZcNot();this.put("tbpcFxZcNot", "not");return this;};
 		public M tbpcFxZcNotNull(){if(proxy)return proxy().tbpcFxZcNotNull();this.put("tbpcFxZcNot", "not");this.put("tbpcFxZc", null);return this;};
 		public M tbpcFxZcNot(Object tbpcFxZc){if(proxy)return proxy().tbpcFxZcNot(tbpcFxZc);this.put("tbpcFxZcNot", "not");this.put("tbpcFxZc", tbpcFxZc);return this;};
	 		
			
		
			
	 	
			
		
		/** 权益介绍        **/
		public M tbpcQyJsh(Object tbpcQyJsh){if(proxy)return proxy().tbpcQyJsh(tbpcQyJsh);  this.put("tbpcQyJsh", tbpcQyJsh);return this;};
	 	/** and tbpc_qy_jsh is null */
 		public M tbpcQyJshNull(){if(proxy)return proxy().tbpcQyJshNull();if(this.get("tbpcQyJshNot")==null)this.put("tbpcQyJshNot", "");this.put("tbpcQyJsh", null);return this;};
 		/** not .... */
 		public M tbpcQyJshNot(){if(proxy)return proxy().tbpcQyJshNot();this.put("tbpcQyJshNot", "not");return this;};
 		public M tbpcQyJshNotNull(){if(proxy)return proxy().tbpcQyJshNotNull();this.put("tbpcQyJshNot", "not");this.put("tbpcQyJsh", null);return this;};
 		public M tbpcQyJshNot(Object tbpcQyJsh){if(proxy)return proxy().tbpcQyJshNot(tbpcQyJsh);this.put("tbpcQyJshNot", "not");this.put("tbpcQyJsh", tbpcQyJsh);return this;};
	 		
			
		
			
	 	
			
		
		/** 加入条件        **/
		public M tbpcJrTj(Object tbpcJrTj){if(proxy)return proxy().tbpcJrTj(tbpcJrTj);  this.put("tbpcJrTj", tbpcJrTj);return this;};
	 	/** and tbpc_jr_tj is null */
 		public M tbpcJrTjNull(){if(proxy)return proxy().tbpcJrTjNull();if(this.get("tbpcJrTjNot")==null)this.put("tbpcJrTjNot", "");this.put("tbpcJrTj", null);return this;};
 		/** not .... */
 		public M tbpcJrTjNot(){if(proxy)return proxy().tbpcJrTjNot();this.put("tbpcJrTjNot", "not");return this;};
 		public M tbpcJrTjNotNull(){if(proxy)return proxy().tbpcJrTjNotNull();this.put("tbpcJrTjNot", "not");this.put("tbpcJrTj", null);return this;};
 		public M tbpcJrTjNot(Object tbpcJrTj){if(proxy)return proxy().tbpcJrTjNot(tbpcJrTj);this.put("tbpcJrTjNot", "not");this.put("tbpcJrTj", tbpcJrTj);return this;};
	 		
			
		
			
	 	
			
		
		/** 合伙人权益介绍        **/
		public M tbpcHhrQy(Object tbpcHhrQy){if(proxy)return proxy().tbpcHhrQy(tbpcHhrQy);  this.put("tbpcHhrQy", tbpcHhrQy);return this;};
	 	/** and tbpc_hhr_qy is null */
 		public M tbpcHhrQyNull(){if(proxy)return proxy().tbpcHhrQyNull();if(this.get("tbpcHhrQyNot")==null)this.put("tbpcHhrQyNot", "");this.put("tbpcHhrQy", null);return this;};
 		/** not .... */
 		public M tbpcHhrQyNot(){if(proxy)return proxy().tbpcHhrQyNot();this.put("tbpcHhrQyNot", "not");return this;};
 		public M tbpcHhrQyNotNull(){if(proxy)return proxy().tbpcHhrQyNotNull();this.put("tbpcHhrQyNot", "not");this.put("tbpcHhrQy", null);return this;};
 		public M tbpcHhrQyNot(Object tbpcHhrQy){if(proxy)return proxy().tbpcHhrQyNot(tbpcHhrQy);this.put("tbpcHhrQyNot", "not");this.put("tbpcHhrQy", tbpcHhrQy);return this;};
	 		
			
		
			
	 	
			
		
		/** 二维码        **/
		public M tbpcQrCode(Object tbpcQrCode){if(proxy)return proxy().tbpcQrCode(tbpcQrCode);  this.put("tbpcQrCode", tbpcQrCode);return this;};
	 	/** and tbpc_qr_code is null */
 		public M tbpcQrCodeNull(){if(proxy)return proxy().tbpcQrCodeNull();if(this.get("tbpcQrCodeNot")==null)this.put("tbpcQrCodeNot", "");this.put("tbpcQrCode", null);return this;};
 		/** not .... */
 		public M tbpcQrCodeNot(){if(proxy)return proxy().tbpcQrCodeNot();this.put("tbpcQrCodeNot", "not");return this;};
 		public M tbpcQrCodeNotNull(){if(proxy)return proxy().tbpcQrCodeNotNull();this.put("tbpcQrCodeNot", "not");this.put("tbpcQrCode", null);return this;};
 		public M tbpcQrCodeNot(Object tbpcQrCode){if(proxy)return proxy().tbpcQrCodeNot(tbpcQrCode);this.put("tbpcQrCodeNot", "not");this.put("tbpcQrCode", tbpcQrCode);return this;};
	 		
			
		
			
	 	
	 	public M add(String key, Object value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	 	public M add(F key, Object value) {if(proxy)return proxy().add(key,value);this.put(key.toString(), value);return this;}
	 	
	 	public M desc(C key) {if(proxy)return proxy().desc(key);this.put("desc", key.column);return this;}
	 	public M asc(C key) {if(proxy)return proxy().asc(key);this.put("asc", key.column);return this;}
	 	public M desc(String sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	 	public M asc(String sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	 	public M definex(String sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	 	
	 	/** 获取所有合伙人卡配置 **/
		public @api List<TbPartnerConfig> list(Integer size){			
			return getTbPartnerConfigList(this,size);
		}
		/** 获取合伙人卡配置分页 **/
		public @api Page<TbPartnerConfig> page(Integer page,Integer size){			
			return getTbPartnerConfigPage(page, size , this);
		}
		/** 根据查询条件取合伙人卡配置 **/
		public @api TbPartnerConfig get(){			
			return getTbPartnerConfig(this);
		}
		/** 获取合伙人卡配置数 **/
		public @api Long count(){			
			return getTbPartnerConfigCount(this);
		}
		/** 获取合伙人卡配置表达式 **/
		public @api <T> T eval(String strEval){			
			return getTbPartnerConfigEval(strEval,this);
		}
		
		/** 获取合伙人卡配置统计 **/
		public @api List<Map> stats(C sumKey,C groupKey,int dateType){			
			return getTbPartnerConfigStats(this,sumKey,groupKey,dateType);
		}
		/** 获取合伙人卡配置统计 **/
		public @api List<Map> stats(C sumKey,C groupKey){			
			return getTbPartnerConfigStats(this,sumKey,groupKey,-1);
		}
		
		/** 根据条件更新 **/
		public @api int update(){			
			M where = null;
			M set = null;
			if(this.type==0){
				if(this.linked==null)throw new RuntimeException("未发set");
				where = this;
				set = this.linked;
			}else{
				if(this.linked==null)throw new RuntimeException("未发where条件");
				set = this;
				where = this.linked;
			}
			return updateTbPartnerConfig(set,where);
		}
		/** 根据条件删除 **/
		public @api void delete(){			
			deleteTbPartnerConfig(this);
		}
	}
	
	public static class Param extends M{
		public Param(int type) {
			super(type);
		}
		public Param(int type, Boolean proxy) {
			super(type, proxy);
		}
	}
	
	/** 对象的字段描述 **/
	public static class F{
		
			
		/** 编号 [非空]       **/
		public final static @type(Long.class)  String tbpcId="tbpcId";
	 			
			
	 	
			
		/** 品牌  [Merchant]      **/
		public final static @type(Long.class)  String tbpcBrand="tbpcBrand";
	 			
			
	 	
			
		/** 合伙人卡名称        **/
		public final static @type(String.class)  String tbpcCardName="tbpcCardName";
	 			
			
	 	
			
		/** 价格        **/
		public final static @type(Double.class)  String tbpcPrice="tbpcPrice";
	 			
		/** and tbpc_price >= ? */
		public final static @type(Double.class) String tbpcPriceMin="tbpcPriceMin";
		/** and tbpc_price <= ? */
		public final static @type(Double.class) String tbpcPriceMax="tbpcPriceMax";
				
			
	 	
			
		/** 产品配置    query:goods text:number money:price     **/
		public final static @type(String.class) @like String tbpcProducts="tbpcProducts";
	 			
			
	 	
			
		/** 普通间接奖励        **/
		public final static @type(Double.class)  String tbpcPtJj="tbpcPtJj";
	 			
		/** and tbpc_pt_jj >= ? */
		public final static @type(Double.class) String tbpcPtJjMin="tbpcPtJjMin";
		/** and tbpc_pt_jj <= ? */
		public final static @type(Double.class) String tbpcPtJjMax="tbpcPtJjMax";
				
			
	 	
			
		/** 普通直接奖励        **/
		public final static @type(Double.class)  String tbpcPtZhj="tbpcPtZhj";
	 			
		/** and tbpc_pt_zhj >= ? */
		public final static @type(Double.class) String tbpcPtZhjMin="tbpcPtZhjMin";
		/** and tbpc_pt_zhj <= ? */
		public final static @type(Double.class) String tbpcPtZhjMax="tbpcPtZhjMax";
				
			
	 	
			
		/** 代理间接奖励        **/
		public final static @type(Double.class)  String tbpcDlJj="tbpcDlJj";
	 			
		/** and tbpc_dl_jj >= ? */
		public final static @type(Double.class) String tbpcDlJjMin="tbpcDlJjMin";
		/** and tbpc_dl_jj <= ? */
		public final static @type(Double.class) String tbpcDlJjMax="tbpcDlJjMax";
				
			
	 	
			
		/** 代理直接奖励        **/
		public final static @type(Double.class)  String tbpcDlZhj="tbpcDlZhj";
	 			
		/** and tbpc_dl_zhj >= ? */
		public final static @type(Double.class) String tbpcDlZhjMin="tbpcDlZhjMin";
		/** and tbpc_dl_zhj <= ? */
		public final static @type(Double.class) String tbpcDlZhjMax="tbpcDlZhjMax";
				
			
	 	
			
		/** 合伙人有效期     已月为单位12 代表12个月后失效   **/
		public final static @type(Integer.class)  String tbpcValidity="tbpcValidity";
	 			
		/** and tbpc_validity >= ? */
		public final static @type(Integer.class) String tbpcValidityMin="tbpcValidityMin";
		/** and tbpc_validity <= ? */
		public final static @type(Integer.class) String tbpcValidityMax="tbpcValidityMax";
				
			
	 	
			
		/** 续期订单总额     总金额大于设置的金额，要到期的时候自动续有效期。   **/
		public final static @type(Double.class)  String tbpcMoney="tbpcMoney";
	 			
		/** and tbpc_money >= ? */
		public final static @type(Double.class) String tbpcMoneyMin="tbpcMoneyMin";
		/** and tbpc_money <= ? */
		public final static @type(Double.class) String tbpcMoneyMax="tbpcMoneyMax";
				
			
	 	
			
		/** 政策概述        **/
		public final static @type(String.class) @like String tbpcZcGsh="tbpcZcGsh";
	 			
			
	 	
			
		/** 协议        **/
		public final static @type(String.class) @like String tbpcXy="tbpcXy";
	 			
			
	 	
			
		/** 奖励政策        **/
		public final static @type(String.class) @like String tbpcFxZc="tbpcFxZc";
	 			
			
	 	
			
		/** 权益介绍        **/
		public final static @type(String.class) @like String tbpcQyJsh="tbpcQyJsh";
	 			
			
	 	
			
		/** 加入条件        **/
		public final static @type(String.class) @like String tbpcJrTj="tbpcJrTj";
	 			
			
	 	
			
		/** 合伙人权益介绍        **/
		public final static @type(String.class) @like String tbpcHhrQy="tbpcHhrQy";
	 			
			
	 	
			
		/** 二维码        **/
		public final static @type(String.class)  String tbpcQrCode="tbpcQrCode";
	 			
			
	 	
	 	public static String get(String name){
			try {
				Field field = F.class.getField(name);
				if(field!=null)
					return field.get(null).toString();
			} catch (Exception e) {
				//e.printStackTrace();
			}
			return null;
		}
	}
	
	
	
	/** 对象的数据库字段描述 **/
	public static enum C{
		
		tbpcId("tbpc_id"),
		tbpcBrand("tbpc_brand"),
		tbpcCardName("tbpc_card_name"),
		tbpcPrice("tbpc_price"),
		tbpcProducts("tbpc_products"),
		tbpcPtJj("tbpc_pt_jj"),
		tbpcPtZhj("tbpc_pt_zhj"),
		tbpcDlJj("tbpc_dl_jj"),
		tbpcDlZhj("tbpc_dl_zhj"),
		tbpcValidity("tbpc_validity"),
		tbpcMoney("tbpc_money"),
		tbpcZcGsh("tbpc_zc_gsh"),
		tbpcXy("tbpc_xy"),
		tbpcFxZc("tbpc_fx_zc"),
		tbpcQyJsh("tbpc_qy_jsh"),
		tbpcJrTj("tbpc_jr_tj"),
		tbpcHhrQy("tbpc_hhr_qy"),
		tbpcQrCode("tbpc_qr_code"),
		count("count");
		String column;
		C(String column){
			this.column = column;
		}
		public String toString(){
			return this.column;
		}
		public static String get(String name){
			try {
				Field field = C.class.getField(name);
				if(field!=null)
					return field.get(null).toString();
			} catch (Exception e) {
				//e.printStackTrace();
			}
			return null;
		}
	}
	
	
	
	
	/**
	* 获取合伙人卡配置数据
	**/
	public static Object getData(Object param){
		if(param==null)
			return null;
		Object value = null;
		if(param.getClass()==Long.class)
			value = TbPartnerConfig.get((Long)param);
		else if(param instanceof java.util.Map){
			java.util.Map params = (Map) param;
			if(params.get("size")==null)
				value = TbPartnerConfig.getTbPartnerConfig(params);
			else
				value = TbPartnerConfig.getTbPartnerConfigList(params, (Integer) params.get("size"));
		}else if(param.getClass()==Long.class )
			value =  TbPartnerConfig.where().tbpcId(param).get();
		else if(!Utils.empty(param.toString()))
			value = TbPartnerConfig.get(Long.valueOf(param.toString()));
		return value;
	}
	
	/**对象转json**/
	public Map toJSON(){
		return toJSON(false);
	}
	public Map toJSON(boolean simple){
		return toJSON(simple,0);
	}
	public Map toJSON(boolean simple,int step){
		Map map = new HashMap();
		map.put("id",this.getTbpcId());
	
		Utils.fms(map,simple?"id":"tbpcId",this.getTbpcId(),this.getTbpcId$());
		
			
 		
	
		Utils.fms(map,simple?"brand":"tbpcBrand",this.getTbpcBrand(),this.getTbpcBrand$());
		
			
 		
	
		Utils.fms(map,simple?"cardName":"tbpcCardName",this.getTbpcCardName(),this.getTbpcCardName$());
		
			
 		
	
		Utils.fms(map,simple?"price":"tbpcPrice",this.getTbpcPrice(),this.getTbpcPrice$());
		
			
 		
	
		Utils.fms(map,simple?"products":"tbpcProducts",this.getTbpcProducts(),this.getTbpcProducts$());
		
			
 		
	
		Utils.fms(map,simple?"ptJj":"tbpcPtJj",this.getTbpcPtJj(),this.getTbpcPtJj$());
		
			
 		
	
		Utils.fms(map,simple?"ptZhj":"tbpcPtZhj",this.getTbpcPtZhj(),this.getTbpcPtZhj$());
		
			
 		
	
		Utils.fms(map,simple?"dlJj":"tbpcDlJj",this.getTbpcDlJj(),this.getTbpcDlJj$());
		
			
 		
	
		Utils.fms(map,simple?"dlZhj":"tbpcDlZhj",this.getTbpcDlZhj(),this.getTbpcDlZhj$());
		
			
 		
	
		Utils.fms(map,simple?"validity":"tbpcValidity",this.getTbpcValidity(),this.getTbpcValidity$());
		
			
 		
	
		Utils.fms(map,simple?"money":"tbpcMoney",this.getTbpcMoney(),this.getTbpcMoney$());
		
			
 		
	
		Utils.fms(map,simple?"zcGsh":"tbpcZcGsh",this.getTbpcZcGsh(),this.getTbpcZcGsh$());
		
			
 		
	
		Utils.fms(map,simple?"xy":"tbpcXy",this.getTbpcXy(),this.getTbpcXy$());
		
			
 		
	
		Utils.fms(map,simple?"fxZc":"tbpcFxZc",this.getTbpcFxZc(),this.getTbpcFxZc$());
		
			
 		
	
		Utils.fms(map,simple?"qyJsh":"tbpcQyJsh",this.getTbpcQyJsh(),this.getTbpcQyJsh$());
		
			
 		
	
		Utils.fms(map,simple?"jrTj":"tbpcJrTj",this.getTbpcJrTj(),this.getTbpcJrTj$());
		
			
 		
	
		Utils.fms(map,simple?"hhrQy":"tbpcHhrQy",this.getTbpcHhrQy(),this.getTbpcHhrQy$());
		
			
 		
	
		Utils.fms(map,simple?"qrCode":"tbpcQrCode",this.getTbpcQrCode(),this.getTbpcQrCode$());
		
			
 		
	
		if(this.suffix!=null)map.put("suffix", this.suffix);
		
		/************LAZY3Q_DEFINE_TOJSON************/
		/************LAZY3Q_DEFINE_TOJSON************/
		return map;
	}
	/**对象转map**/
	public Map toMap(){
		Map map = new HashMap();
	
		map.put("tbpcId",this.getTbpcId());
 		
	
		map.put("tbpcBrand",this.getTbpcBrand());
 		
	
		map.put("tbpcCardName",this.getTbpcCardName());
 		
	
		map.put("tbpcPrice",this.getTbpcPrice());
 		
	
		map.put("tbpcProducts",this.getTbpcProducts());
 		
	
		map.put("tbpcPtJj",this.getTbpcPtJj());
 		
	
		map.put("tbpcPtZhj",this.getTbpcPtZhj());
 		
	
		map.put("tbpcDlJj",this.getTbpcDlJj());
 		
	
		map.put("tbpcDlZhj",this.getTbpcDlZhj());
 		
	
		map.put("tbpcValidity",this.getTbpcValidity());
 		
	
		map.put("tbpcMoney",this.getTbpcMoney());
 		
	
		map.put("tbpcZcGsh",this.getTbpcZcGsh());
 		
	
		map.put("tbpcXy",this.getTbpcXy());
 		
	
		map.put("tbpcFxZc",this.getTbpcFxZc());
 		
	
		map.put("tbpcQyJsh",this.getTbpcQyJsh());
 		
	
		map.put("tbpcJrTj",this.getTbpcJrTj());
 		
	
		map.put("tbpcHhrQy",this.getTbpcHhrQy());
 		
	
		map.put("tbpcQrCode",this.getTbpcQrCode());
 		
	
		map.put("suffix", this.suffix);
		
		/************LAZY3Q_DEFINE_TOMAP************/
		/************LAZY3Q_DEFINE_TOMAP************/
		return map;
	}
	/**map转对象**/
	public static TbPartnerConfig fromMap(Map map){
		TbPartnerConfig tbPartnerConfig = new TbPartnerConfig();
	
		tbPartnerConfig.tbpcId = Utils.parseLong(map.get("tbpcId"));
 		
	
		tbPartnerConfig.tbpcBrand = Utils.parseLong(map.get("tbpcBrand"));
 		
	
		tbPartnerConfig.tbpcCardName = Utils.parseString(map.get("tbpcCardName"));
 		
	
		tbPartnerConfig.tbpcPrice = Utils.parseDouble(map.get("tbpcPrice"));
 		
	
		tbPartnerConfig.tbpcProducts = Utils.parseString(map.get("tbpcProducts"));
 		
	
		tbPartnerConfig.tbpcPtJj = Utils.parseDouble(map.get("tbpcPtJj"));
 		
	
		tbPartnerConfig.tbpcPtZhj = Utils.parseDouble(map.get("tbpcPtZhj"));
 		
	
		tbPartnerConfig.tbpcDlJj = Utils.parseDouble(map.get("tbpcDlJj"));
 		
	
		tbPartnerConfig.tbpcDlZhj = Utils.parseDouble(map.get("tbpcDlZhj"));
 		
	
		tbPartnerConfig.tbpcValidity = Utils.parseInteger(map.get("tbpcValidity"));
 		
	
		tbPartnerConfig.tbpcMoney = Utils.parseDouble(map.get("tbpcMoney"));
 		
	
		tbPartnerConfig.tbpcZcGsh = Utils.parseString(map.get("tbpcZcGsh"));
 		
	
		tbPartnerConfig.tbpcXy = Utils.parseString(map.get("tbpcXy"));
 		
	
		tbPartnerConfig.tbpcFxZc = Utils.parseString(map.get("tbpcFxZc"));
 		
	
		tbPartnerConfig.tbpcQyJsh = Utils.parseString(map.get("tbpcQyJsh"));
 		
	
		tbPartnerConfig.tbpcJrTj = Utils.parseString(map.get("tbpcJrTj"));
 		
	
		tbPartnerConfig.tbpcHhrQy = Utils.parseString(map.get("tbpcHhrQy"));
 		
	
		tbPartnerConfig.tbpcQrCode = Utils.parseString(map.get("tbpcQrCode"));
 		
	
		return tbPartnerConfig;
	}
	
	
	/**字段设置标记队列**/
	private Map<String,Boolean> seted=new HashMap();
	public Boolean getSeted(String key){
		return seted.get(key);
	}
	public void setSeted(String key){
		seted.put(key,true);
	}
	/**同步未set的字段**/
	public void mergeSet(TbPartnerConfig old){
		Field[] fields = this.getClass().getDeclaredFields();
		try {
			for(Field field:fields){
				String key = field.getName();
				if(seted.get(key)==null && field.getAnnotation(column.class)!=null){
					field.setAccessible(true);
					field.set(this, field.get(old));					
				}
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	
		
	/**自定义变量存储**/
	private Map values=new HashMap();
	public Map getValues(){
		return values;
	}
	public void setValues(String name,Object value){
		values.put(name,value);
	}
	
	/**分表时的表名后缀**/
	private String suffix;
	public String getSuffix() {
		return suffix;
	}
	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}
	
	
	/**获取数据库名称**/
	public static String getDataBaseName(){
		return Utils.config("spring.datasource.distribute_sys.name");
	}
	
	
	public static String getIcon(){
		return "/images/icons/20088256422923477804.png";
	}
	public static String getIconfont(){
		return "icon-yinxingqia3";
	}
	public static enum ACT{
		列表,添加,修改,详情
	};
	public static String getUrl(ACT act,TbPartnerConfig.M params){
		if(params==null)params=new TbPartnerConfig.M(0);
		params.remove("joins");
		params.remove("definexs");
		params.remove("distinct");
		String strUrl = "/admin/partner/config.edit.html?";
		if(params.get("tbpcId")!=null){
			strUrl+="&id="+Utils.encode(""+params.get("tbpcId"),Utils.UTF8);
		}
		if(act==ACT.列表){
			strUrl = "/admin/partner/config.html?1=1";
		
		}else if(act==ACT.添加){
			strUrl+="&edittype=insert";
		
		
		}else if(act==ACT.修改){
			strUrl+="&edittype=update";
		
		}else if(act==ACT.详情){
			strUrl+="&edittype=detail";
		
		}		
		if(params!=null){
			for(Object key:params.keySet()){
				strUrl+="&"+key+"="+Utils.encode(""+params.get(key),Utils.UTF8)+"";
			}
		}
		return strUrl;
	}
	public String getDetailUrl(){
		return this.getUrl(ACT.详情, where.tbpcId(this.getId()));
	}
	
	/**
	* 转跳到当前地址
	**/
	public static Protocol redirect(TbPartnerConfig.ACT act,TbPartnerConfig.M params){
		Protocol protocol = Protocol.create(true,null,"ACT_REDIRECT");
		protocol.set("url",TbPartnerConfig.getUrl(act, params));
		return protocol;
	}
	/**
	* 打开一个新的tab页面
	**/
	public static Protocol href(TbPartnerConfig.ACT act,TbPartnerConfig.M params){
		Protocol protocol = Protocol.create(true,null,"ACT_HREF");
		protocol.set("url",TbPartnerConfig.getUrl(act, params));
		protocol.set("title",act.name());
		return protocol;
	}
	/**
	* 显示一个消息框，并且关闭当前的对话框
	**/
	public static Protocol message(String message){
		Protocol protocol = Protocol.create(true,null,"ACT_MESSAGE");
		protocol.set("message",message);
		return protocol;
	}
	
	
	static com.distribute.framework.dao.ITbPartnerConfigDao getTbPartnerConfigDao(){
		return Utils.getBean("tbPartnerConfigDao");
	};
	
}